import Vue from "vue"
import Router from "vue-router"
import Admin from './views/admin.vue'
import Home from './views/admin/home'
import Login from './views/login.vue'
import Category from './views/admin/category'
import Teacher from './views/admin/teacher'
import Course from './views/admin/course'
import Chapter from './views/admin/chapter'
import Section from './views/admin/section'
import Content from './views/admin/content'
import Member from './views/admin/member'
import File from './views/admin/uploadFile'
import User from './views/admin/user'
import Resource from './views/admin/resource'
import Role from './views/admin/role'

Vue.use(Router);

export default new Router({
    mode: "history",
    base: process.env.BASE_URL,
    routes:[
        {
            path:"*", // 路径（URL上的路径）
            name:"show", // 命名路由会用到
            component:Login // 指定要渲染的组件
        },
        {
            path:"/login", // 路径（URL上的路径）
            name:"show", // 命名路由会用到
            component:Login // 指定要渲染的组件
        },
        {
            path:"/",
            name:"admin",
            component:Admin,
            meta:{
                loginRequire:true
            },
            children:[{
                    path: "home",
                    name: "home",
                    component: Home,
                },
                {
                    path:"business/chapter",
                    name:"business/chapter",
                    component:Chapter
                },
                {
                    path:"business/section",
                    name:"business/section",
                    component:Section
                },
                {
                    path:"business/category",
                    name:"business/category",
                    component:Category
                },
                {
                    path:"business/teacher",
                    name:"business/teacher",
                    component:Teacher
                },
                {
                    path:"business/content",
                    name:"business/content",
                    component:Content
                },
                {
                    path:"business/course",
                    name:"business/course",
                    component:Course
                },
                {
                    path:"business/member",
                    name:"business/member",
                    component:Member
                },
                {
                    path:"file/uploadFile",
                    name:"file/uploadFile",
                    component:File
                },
                {
                    path:"system/user",
                    name:"system/user",
                    component:User
                },
                {
                    path:"system/resource",
                    name:"system/resource",
                    component:Resource
                },
                {
                    path:"system/role",
                    name:"system/role",
                    component:Role
                }
            ]
        }
    ]
})
